/**
 * 作者：陈文斌 on 2019/1/28.
 * 邮箱：chen_wennbin@163.com
 * 版本：v1.0
 */

import 'package:flutter/material.dart';
import 'package:crm/view/AppBar/custom_app_bar.dart';
import 'package:crm/model/PainPoint/pain_point_model.dart';
import 'package:crm/component/PainPoint/pain_point_edit_section.dart';

const String AddPainPointTitle = '添加客户痛点';
const String EditPainPointTitle = '编辑客户痛点';

class AddPainPointRecordPage extends StatefulWidget {
  final PainPointModel painPoint;

  AddPainPointRecordPage({
    Key key,
    this.painPoint,
  }) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return _AddPainPointRecordPageState();
  }
}

class _AddPainPointRecordPageState extends State<AddPainPointRecordPage> {
  PainPointModel _painPoint;

  @override
  void initState() {
    super.initState();
    _painPoint = _painPoint ?? PainPointModel.fromJson({});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar(
        title: _painPoint.id == null
            ? AddPainPointTitle
            : EditPainPointTitle,
      ),
      body: PainPointEditSection(painPoint: _painPoint),
    );
  }
}
